/**
 * 
 */
package com.tool;

import java.io.File;

import cn.hutool.core.net.NetUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.setting.Setting;

/**
 * @author w_weizhen@sina.com
 * 参数
 */
public class Parameter 
{
    //项目所在目录
    public static final String user_dir = System.getProperty("user.dir") + File.separator;
    //文件存放目录,log日志;tmp临时文件
    public static final String data_path = user_dir + "data" + File.separator;
    public static final String log_path = data_path + "log" + File.separator;
    public static final String tmp_path = data_path + "tmp" + File.separator;
    //索引文件
    public static final String indexes = "indexes.json";
    public static final String indexes_path = tmp_path + indexes;
    //读取classpath下的config.setting,不使用变量
    public static final Setting setting = new Setting(user_dir+"config.setting", CharsetUtil.CHARSET_UTF_8, true);
    //是否服务端
    public static final Boolean isServer = "server".equals(setting.getStr("type"));
    //指定本地文件所在目录的路径
    public static final String local_file = setting.getStr("local_file");
    //文件服务远程路径,仅客户端可用
    public static final String server_uri = setting.getStr("server_uri");
    //指定端口号,仅客户端可用
    public static final Integer port = setting.getInt("port")!=null&&NetUtil.isValidPort(setting.getInt("port"))?setting.getInt("port"):21;
    public static final String cron = setting.getStr("cron");//表达式,指定下载时间间隔
    public static final Boolean log = setting.getBool("log");//是否开启日志
    public static final Integer expire_logs_days = setting.getInt("expire_logs_days");//日志保存天数
    public static long times = 0;//计算循环次数
    public static File tmpDirectory ;//临时文件目录
}